package com.itheima.home_work.net_shop;

import java.sql.Array;
import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        // 商品排序
        // 初始化一些商品
        Product[] products = new Product[10];

        products[0] = new Product(1, "感冒灵", "药", 20.5, 1000, 100);
        products[1] = new Product(2, "体力给", "瞎", 10.0, 600, 500);
        products[2] = new Product(3, "盖帽", "给", 50.5, 2300, 2100);
        products[3] = new Product(4, "会不冷", "药", 120.5, 1200, 5200);
        products[4] = new Product(5, "水太冷", "瞎", 49.5, 400, 700);
        products[5] = new Product(6, "茶不好喝", "瞎", 112.5, 700, 350);
        products[6] = new Product(7, "风太大", "药", 56.0, 1300, 120);
        products[7] = new Product(8, "水上漂", "给", 34.5, 5200, 5700);
        products[8] = new Product(9, "铁布衫", "给", 200.0, 1600, 1600);
        products[9] = new Product(10, "吹牛逼", "药", 2.5, 900, 2800);

        System.out.println("默认情况下是按照商品销量排列展示[从小到大]");
        Arrays.sort(products);

        System.out.println(Arrays.toString(products));

        System.out.println("按照价格排列展示[从小到大]");
        new ProductSortByPrice().sort(products);

        System.out.println(Arrays.toString(products));

        System.out.println("按照库存排列展示[从大到小]");
        new ProductsSortByInventory().sort(products);
        System.out.println(Arrays.toString(products));

    }
}
